package com.wz.compiler.libExpr;

import com.wz.compiler.expr.ExprLexer;
import com.wz.compiler.expr.ExprParser;
import org.antlr.v4.runtime.CharStream;
import org.antlr.v4.runtime.CharStreams;
import org.antlr.v4.runtime.CommonTokenStream;

import java.io.IOException;

public class LibExprTest {

    public static void main(String[] args) throws IOException {
        System.out.println("plz input:");

        CharStream input = CharStreams.fromStream(System.in);
        LibExprLexer lexer = new LibExprLexer(input);
        CommonTokenStream tokens = new CommonTokenStream(lexer);
        LibExprParser parser = new LibExprParser(tokens);

        LibExprParser.ProgContext progContext = parser.prog();

        System.out.println(progContext.toStringTree(parser));
//
//        ParseTreeWalker walker = new ParseTreeWalker();
//
//        walker.walk(new ShortToUnicodeString(), statContext.getRuleContext());
//        System.out.println("\n");
    }
}
